package com.kan.bargain.controller;

import java.util.Arrays;
import java.util.Map;


import com.miao.commonn.vo.BargainVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kan.bargain.entity.BordersEntity;
import com.kan.bargain.service.BordersService;
import com.miao.commonn.utils.PageUtils;
import com.miao.commonn.utils.R;



/**
 * 
 *
 * @author xk
 * @email 2337156522@QQ.com
 * @date 2022-03-11 14:13:23
 */
@RestController
@RequestMapping("bargain/borders")
public class BordersController {
    @Autowired
    private BordersService bordersService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bordersService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{boid}")
    public R info(@PathVariable("boid") Integer boid){
		BordersEntity borders = bordersService.getById(boid);

        return R.ok().put("borders", borders);
    }
    @RequestMapping("/info1")
    public R info1(@RequestParam Integer boid){
        BordersEntity borders = bordersService.getById(boid);

        return R.ok().put("borders", borders);
    }
    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestParam Integer bid,@RequestParam Integer uid){



        return bordersService.instart(bid,uid);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody BordersEntity borders){
		bordersService.updateById(borders);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] boids){
		bordersService.removeByIds(Arrays.asList(boids));

        return R.ok();
    }

}
